<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddExtractToOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('recharge_order', function (Blueprint $table) {
            $table->string('user_mobile',50)->nullable()->comment('用户手机号');
            $table->tinyInteger('card_type')->comment('油卡类型1中石化2中石油');
            $table->string('card_no',50)->nullable()->comment('油卡卡号');
            $table->tinyInteger('recharge_mode')->default(1)->comment('充值方式1自动2手动3混合');
            $table->string('handle_remark')->nullable()->comment('手动充值的备注信息');
            $table->index(['recharge_mode']);
        });

        Schema::table('recharge_order_detail', function (Blueprint $table) {
            $table->string('user_mobile',50)->nullable()->comment('用户手机号');
            $table->tinyInteger('card_type')->comment('油卡类型1中石化2中石油');
            $table->string('card_no',50)->nullable()->comment('油卡卡号');
            $table->tinyInteger('recharge_mode')->default(1)->comment('充值方式1自动2手动');
            $table->string('handle_remark')->nullable()->comment('手动充值的备注信息');
            $table->index(['recharge_mode']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('recharge_order', function (Blueprint $table) {
            $table->dropColumn(['user_mobile','card_type','card_no','recharge_mode','handle_remark']);
        });
        Schema::table('recharge_order_detail', function (Blueprint $table) {
            $table->dropColumn(['user_mobile','card_type','card_no','recharge_mode','handle_remark']);
        });
    }
}
